﻿using System.Windows.Forms;

namespace ThinkDotNetEditorLib.Services.DialogWindowService
{
    public class DialogWindowService:IDialogWindowService
    {
        public bool? ShowDialog(object owner,ICustomDialog customDialog)
        {
            return customDialog.ShowDialog(owner);
        }

        public string ShowOpenFileDialog(string filter)
        {
            OpenFileDialog openFileDialog=new OpenFileDialog();
            openFileDialog.Filter = filter;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
                return openFileDialog.FileName;
            return null;
        }
        public string ShowSaveFileDialog(string filter)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = filter;
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
                return saveFileDialog.FileName;
            return null;
        }
    }
}
